package com.casa.gwtproject.dao.generic;

import java.io.Serializable;
import java.util.List;

/**
 * Generic Dao for ORM
 * @author JuanLuis
 *
 * @param <Entity> Entity
 * @param <PK> Primary Key
 */
public interface GenericDao <Entity extends Serializable, PK extends Serializable>
{
	/**
	 * Save the item
	 * @param item item
	 * @return pk
	 */
	void save (Entity item);
	
	/**
	 * Update the item
	 * @param item
	 */
	void update (Entity item);
	
	/**
	 * Delete the item
	 * @param id item's PK
	 */
	void delete (Entity entity);
	
	/**
	 * Find a list of items with the given filters
	 * @param item item filters
	 * @return list of items or empty list if not found
	 */
	List<Entity> find (Entity item);
}
